<% layout("../../includes/layout-form-v2") -%>

<form id="form" class="form-submission backend edit id_<%-id  %>" title="user-permission" action='<%- id %>' method='post'>

    <h1><%- record['user_group_name'] %></h1>
    

    
	<table class="table table-bordered">
		<tr>
			<th>Admin</th>
			<td><input name="has_admin_role" value="1" <%- (HAS_ACCESS_ROLE(record['user_group_id'], "has_admin_role" )) ? "checked" : "" %>  type="checkbox"></td>
			<td colspan="3"></td>
		</tr>
		<tr>
			<th>Manager</th>
			<td><input name="has_manager_role" value="1" <%- (HAS_ACCESS_ROLE(record['user_group_id'], "has_manager_role")) ? "checked" : "" %> type="checkbox"></td>
			<td colspan="3"></td>
		</tr>
		<tr>
			<th>Cashier</th>
			<td><input name="has_cashier_role" value="1" <%- (HAS_ACCESS_ROLE(record['user_group_id'], "has_cashier_role")) ? "checked" : "" %> type="checkbox"></td>
			<td colspan="3"></td>
		</tr>
		<tr>
			<td colspan="5"></td>
		</tr>
		<tr>
			<th>Module</th>
			<th>View</th>
			<th>Add</th>
			<th>Update</th>
			<th>Delete</th>
		</tr>
	    <% if(refData.permissionsData.length){ 
	     for(var i = 0;i < refData.permissionsData.length;i++) { %>   
		
		<tr>
			<td><%- refData.permissionsData[i].label %>
			</td>
			<td><input name="can_view_<%-refData.permissionsData[i].controller%>" value="1" <%- (HAS_ACCESS_ROLE(record['user_group_id'], "can_view_" + refData.permissionsData[i].controller)) ? "checked" : "" %>  type="checkbox"></td>
			<td><input name="can_add_<%-refData.permissionsData[i].controller%>" value="1" <%- (HAS_ACCESS_ROLE(record['user_group_id'], "can_add_" + refData.permissionsData[i].controller)) ? "checked" : "" %> type="checkbox"></td>
			<td><input name="can_edit_<%-refData.permissionsData[i].controller%>" value="1" <%- (HAS_ACCESS_ROLE(record['user_group_id'], "can_edit_" + refData.permissionsData[i].controller)) ? "checked" : "" %> type="checkbox"></td>
			<td><input name="can_delete_<%-refData.permissionsData[i].controller%>" value="1" <%- (HAS_ACCESS_ROLE(record['user_group_id'], "can_delete_" + refData.permissionsData[i].controller)) ? "checked" : "" %> type="checkbox"></td>
		</tr>
		
		<% } %>
		<% } %>
	
	</table>
	<br />


	<div class="box-footer">
		<input type="submit" class="btn btn-primary btn-lg " value="Update" />
	</div>
</form>

<script type="text/javascript">


</script>
